<!doctype html>
<html lang="zh-hans" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>文章详情页</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/article.css">
</head>
<body>
    <div class="nav">
        <img src="img/logo2.jpg" alt="logo 图">
        <sapn class="title" th:text="${user.nickname} + '的博客'">博客昵称</sapn>
        <span class="spacer"></span>
        <a href="/blog0124/">主页</a>
        <a href="/blog0124/edit.html">写博客</a>
        <a href="/blog0124/login.html">退出登录</a>
    </div>

    <div class="container">
        <div class="container-left">
            <div class="card">
                <img src="/img/girl.jpg" alt="作者头像" class="avatar" th:src="${user.avatar}">
                <h3 th:text="${user.nickname}">作者昵称</h3>
                <a href="git" target="_blank" th:href="${user.git}">我的git</a>

                <div class="counter">
                    <span>文章</span>
                    <span>分类</span>
                </div>

                <div class="counter">
                    <span th:text="${articleCount}">文章数</span>
                    <span th:text="${typeCount}">类型数</span>
                </div>
            </div>
        </div>

        <div class="container-right">
            <div class="blog-content">
                <div class="title" th:text="${article.title}">文章标题</div>
                <div class="date" th:text="${article.publishedAt}">发布时间</div>
                <div id="content" th:text="${article.content}">内容简介</div>
            </div>
        </div>

        <div>
            <!-- 引入 editor.md -->
            <script src="js/jquery.min.js"></script>
            <script src="editor.md/lib/marked.min.js"></script>
            <script src="editor.md/lib/prettify.min.js"></script>
            <script src="editor.md/editormd.js"></script>
            <script>
                // 找到 id=content 的标签
                // 从标签中读取出 markdown 内容
                var markdown = document.querySelector("#content").innerHTML;
                document.querySelector("#content").innerHTML = "";
                // 利用 editor.md 将 markdown 转成 html 格式，并且填充回 id=content 的标签
                editormd.markdownToHTML('content', { markdown: markdown });
            </script>
        </div>
    </div>
</body>
</html>